package com.api.shop.util;

import com.api.shop.bean.SysUser;

public class MyStringUtil {

    public static SysUser StringToObject(String userStr){
        userStr = userStr.substring(8, userStr.length() - 1);
        String[] strings = userStr.split(",");
        Integer userId = Integer.parseInt(strings[0].trim().substring(7));
        String username = strings[1].trim().substring(9);
//        String password = strings[2].trim().substring(9);
        String password = "";
        String nickName = strings[3].trim().substring(9);
        String avatarUrl = strings[4].trim().substring(7);
        SysUser sysUser = SysUser.builder().userId(userId).username(username).password(password)
                .nickName(nickName).avatar(avatarUrl).build();
        return sysUser;
    }


}
